package com.lotter.api.service;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lotter.common.context.YcContext;
import com.lotter.common.exception.LotterCusException;
import com.lotter.common.util.DateUtil;
import com.lotter.dao.StatisticsIncomeDayMapper;
import com.lotter.dao.StatisticsIncomeMonthMapper;
import com.lotter.dao.StatisticsIncomeYearMapper;
import com.lotter.model.statistics.StatisticsIncomeDay;
import com.lotter.model.statistics.StatisticsIncomeMonth;
import com.lotter.model.statistics.StatisticsIncomeYear;



@Service
public class StatisticsIncomeService {
	
	 @Autowired
	 private StatisticsIncomeDayMapper dayMapper ;
	 
	 @Autowired
	 private StatisticsIncomeMonthMapper monthMapper ;
	 
	 @Autowired
	 private StatisticsIncomeYearMapper yearMapper; 
	 
	 
	 public StatisticsIncomeYear findYearEntity(Long uid) throws LotterCusException{
		 Calendar a=Calendar.getInstance();
		 Integer year_census = a.get(Calendar.YEAR);
		 return yearMapper.findYearMapper(uid, year_census.toString());
	 }
	 
	 public List<StatisticsIncomeMonth> findMonthList(Long yearid) throws LotterCusException{
		 return monthMapper.findMonthList(yearid);
	 }
	 
	 public StatisticsIncomeMonth  findMonthEntity(Long uid)throws LotterCusException{
		 return monthMapper.findMonthEntity(uid, DateUtil.date2String(new Date(), YcContext.DATE_STR_YYYYMM));
	 }

	 public  List<StatisticsIncomeDay> findDayList(Long month_id) throws LotterCusException{
		 return dayMapper.findDayList(month_id);
	 }
	 
}
